function [  ] = showHead( this, fId, kRow, kCol )
% DataMatrix::showHead(dataMatrix, fId, kRow, kCol)
% 
% Input
% 1. dataMatrix
% 2. fId = 1 : (opt) file id into which the head info is printed 
% 3. kRow = 6 : (opt) show the first k rows of $dataMatrix.mat$
% 4. kCol = 6 : (opt) show the first k cols of $dataMatrix.mat$
% 
% Output
% 0. 
% 
% Syntax
% 1. dataMatrix.showHead();
% 2. dataMatrix.showHead(fId, 3, 4); % Print the first 3 rows and 
%                                      the first 4 cols of $dataMatrix.mat% 
%                                      into $fId$.

%% Check input

if nargin == 1
    fId = 1;
    kRow = 6;
    kCol = 6;
end

if nargin == 2
    kRow = 6;
    kCol = 6;
end

[nRow, nCol] = this.getSize();
if kRow > nRow
    kRow = nRow;
end
if kCol > nCol
    kCol = nCol;
end

%% Get the values to print

name = this.name;
mat = this.mat(1:kRow, 1:kCol);
zRowName = this.zRowName(1:kRow);
zColName = this.zColName(1:kCol);

%% Start printing

% Print the first row, i.e., the header
fprintf(fId, '%s\t', name);
for iCol = 1:kCol
    fprintf(fId, '%s\t', zColName{iCol});
end
fprintf(fId, '\n');

% Print the content $.mat(1:kRow, 1:kCol)$
for iRow = 1:kRow
    fprintf(fId, '%s\t', zRowName{iRow});
    for iCol = 1:kCol
        fprintf(fId, '%.4f\t', mat(iRow, iCol));
    end
    fprintf(fId, '\n');
end

end
